{template 'common/header'}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" id="form1">
        <div class="panel panel-default">
            <div class="panel-heading">系统参数设置</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">授权地址</label>
                    <div class="col-sm-9">
                        <input type="text" value="{$_W['siteroot']}" readonly class="form-control"/>
                        <div class="help-block">授权地址</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">授权码</label>
                    <div class="col-sm-9">
                        <input type="password" name="softkey" value="{php echo $isseting['keycode'] ? $isseting['keycode'] : $cfg['softkey']}" class="form-control"/>
                        <div class="help-block">授权地址</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">次级授权码</label>
                    <div class="col-sm-9">
                        <input type="password" name="softkey2" value="{$settings['keycode']}" class="form-control"/>
                        <div class="help-block">仅为IT人员测试用，请勿填写</div>
                    </div>
                </div>
                {if $_W['isfounder']}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">可添加店铺</label>
                    <div class="col-sm-9">
                        <input type="text" name="limitnum" value="{$settings['limitnum']}" class="form-control"/>
                        <div class="help-block">该账号可添加店铺数量</div>
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">经营模式</label>
                    <div class="col-sm-9">
                        <select name="floder">
                            <option value="">选择店铺经营模式</option>
                            {loop _skinflorder() $index $row}
                            <option value="{$index}" {if $settings["floder"]==$index}selected{/if}>{$row}</option>
                            {/loop}
                        </select>
                        <div class="help-block">店铺经营模式，请勿随意修改</div>
                    </div>
                </div>
            </div>
            <div class="panel-heading">各行业皮肤介绍</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">重餐饮</label>
                    <div class="col-sm-9">
                        有餐桌，计算茶位费，先食后付；
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">轻餐饮</label>
                    <div class="col-sm-9">
                        如奶茶，咖啡等，需要制作时间的餐饮，先付后食。支持标签打印机
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">零售</label>
                    <div class="col-sm-9">
                        如便利店，小卖部等，直接选择/扫码销售商品，付款结账；
                    </div>
                </div>
            </div>
            <div class="panel-heading">外卖平台对接</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">说明</label>
                    <div class="col-sm-9">
                        回调地址:{$_W['siteroot']}addons/j_hmoney/plug/plug_elm/callback.php<br>
                        推送URL:{$_W['siteroot']}addons/j_hmoney/plug/plug_elm/push.php
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">饿了么</label>
                    <div class="col-sm-9">
                        <label class="radio-inline">
                            <input type="radio" name="elemdebug" value="0" {if $isseting['elemdebug'] == 0}checked{/if} />
                            测试</label>
                        <label class="radio-inline">
                            <input type="radio" name="elemdebug" value="1" {if $isseting['elemdebug'] == 1}checked{/if} />
                            正式</label>
                        <div class="help-block">开发阶段用【测试】，正式阶段用开启【正式】</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">饿了么参数</label>
                    <div class="col-sm-9 form-inline">
                        <div class="input-group">
                            <span class="input-group-addon">应用名称</span>
                            <input type="text" class="form-control" name="elem_title" value="{$isseting['elem_title']}" />
                        </div>
                        <div class="input-group">
                            <span class="input-group-addon">应用ID</span>
                            <input type="text" class="form-control" name="elem_id" value="{$isseting['elem_id']}"/>
                        </div>
                        <div class="input-group">
                            <span class="input-group-addon">Key</span>
                            <input type="text" class="form-control" name="elem_key" value="{$isseting['elem_key']}"/>
                        </div>
                        <div class="input-group">
                            <span class="input-group-addon">Secret</span>
                            <input type="text" class="form-control" name="elem_secret" value="{$isseting['elem_secret']}"/>
                        </div>
                        <div class="help-block"></div>
                    </div>
                </div>
            </div>
            <div class="panel-heading">更新</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">说明</label>
                    <div class="col-sm-9">下列三项内容，都是安装在客户的电脑上。如果需更新时，上传更新包即可。无需亲自到客户电脑中操作。特此说明</div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">软件更新</label>
                    <div class="col-sm-9">
                        <button type="button" class="btn btn-default" onClick="$('#softurl').click()">{if $isseting['softurl']}{$isseting['softurl']}{else}上传文件{/if}</button>{if $isseting['softurl']}<a href="JavaScript:" class="btn btn-default" onClick="removeFile(1);"><i class="fa fa-remove"></i></a>{/if}
                        <input type="hidden" name="softurl2" id="softurl2" value="{$isseting['softurl']}"/>
                        <input type="file" name="softurl" id="softurl" style="display:none;">
                        <div class="help-block">必须是zip格式的压缩包！建议删除setting.xml文件后压缩</div>
                    </div>
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">会员卡软件更新</label>
                    <div class="col-sm-9">
                        <button type="button" class="btn btn-default" onClick="$('#softmemberurl').click()">{if $isseting['softmemberurl']}{$isseting['softmemberurl']}{else}上传文件{/if}</button>{if $isseting['softmemberurl']}<a href="JavaScript:" class="btn btn-default" onClick="removeFile(2);"><i class="fa fa-remove"></i></a>{/if}
                        <input type="hidden" name="softmemberurl2" id="softmemberurl2" value="{$isseting['softmemberurl']}"/>
                        <input type="file" name="softmemberurl" id="softmemberurl" style="display:none;">
                        <div class="help-block">必须是zip格式的压缩包！建议删除setting.xml文件后压缩</div>
                    </div>
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">APP更新</label>
                    <div class="col-sm-9">
                        <button type="button" class="btn btn-default" onClick="$('#appurl').click()">{if $isseting['appurl']}{$isseting['appurl']}{else}上传文件{/if}</button>{if $isseting['appurl']}<a href="JavaScript:" class="btn btn-default" onClick="removeFile(3);"><i class="fa fa-remove"></i></a>{/if}
                        <input type="hidden" name="appurl2" id="appurl2" value="{$isseting['appurl']}"/>
                        <input type="file" name="appurl" id="appurl" style="display:none;">
                        <div class="help-block">apk/wgt的文件，请勿修改文件名称</div>
                    </div>
                </div>
            </div>


        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
<script language="JavaScript">
    function removeFile(type){
        if(!confirm("确认删除？删除后文件不能恢复"))return;
        $.post("{php echo $this->createWebUrl('ajax',array('op'=>'deleteupdate'))}",{updatetype:type},function(data){
            var result=eval('('+data+')');
            if(result.success){
                if(type==1) {
                    $("#softurl2").val("");
                    $("#softurl2").prev().prev().html("上传文件");
                    $("#softurl2").prev().remove();
                }else if(type==2){
                    $("#softmemberurl2").val("");
                    $("#softmemberurl2").prev().prev().html("上传文件");
                    $("#softmemberurl2").prev().remove();
                }else if(type==3){
                    $("#appurl2").val("");
                    $("#appurl2").prev().prev().html("上传文件");
                    $("#appurl2").prev().remove();
                }
                alert("删除成功，保存后方能生效");
            }else{
                alert(result.msg);
            }
        });
    }
</script>
{template 'common/footer'}